#include "lvgl.h"
#include "lv_port_disp_templ.h"
#include "cmsis_os.h"

void lvgl_app_entry(void)
{
    lv_init();
    lv_port_disp_init();
    
    lv_theme_mono_init(0 /* hue */,NULL /* use LV_FONT_DEFAULT */);
    lv_theme_set_current( lv_theme_get_mono() );
    
    lv_obj_t *btn1 = lv_btn_create(lv_scr_act(), NULL);
    lv_obj_align(btn1, lv_scr_act(), LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_pos(btn1, 0, 16);
    lv_obj_set_size(btn1, 128, 48);
    lv_btn_set_state(btn1, LV_BTN_STATE_PR);
    
    
//    /*Create a Label on the currently active screen*/
//    lv_obj_t * label1 =  lv_label_create(btn1, NULL);
//    /*Modify the Label's text*/

//    lv_label_set_text(label1, "Hello world!");

//    /* Align the Label to the center
//     * NULL means align on parent (which is the screen now)
//     * 0, 0 at the end means an x, y offset after alignment*/
//    lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0);
    
    

    lv_obj_t * label2 = lv_label_create(btn1, NULL);
    lv_label_set_long_mode(label2, LV_LABEL_LONG_SROLL_CIRC);     /*Circular scroll*/
    lv_obj_set_width(label2, 100);
    lv_label_set_text(label2, "It is a circularly scrolling text. ");
    lv_obj_align(label2, NULL, LV_ALIGN_CENTER, 0, 0);
    
    lv_obj_set_click(btn1, true);
    
    
    
    while(1)
    {
        lv_tick_inc(1);
        osDelay(1);
        lv_task_handler();
    }
}
